<template>
  <div id="updateDialog">
    <el-dialog class="box" title="查看测点信息" :visible.sync="updateDialogShow" :before-close="handleClose">
        <el-form :model="viewPoint" ref="viewPoint" label-width="120px" class="demo-form-inline" style="height: 400px; overflow: auto; overflow-x: hidden"  >
          <el-form-item label="测点名称：" >
            <el-col :span="9">
              <el-form-item prop="username" required>
                {{this.viewPoint.name}}
              </el-form-item>
            </el-col>
          </el-form-item>
          <el-form-item label="类型：" >
            <el-col :span="9">
              <el-form-item prop="username" required>
                {{this.viewPoint.type}}
              </el-form-item>
            </el-col>
            <el-col class="line formRight1 userid" :span="5" style="text-align: right"><span class="rightx"></span>地址：</el-col>
            <el-col :span="9">
              <el-form-item prop="name" required>
               {{this.viewPoint.addr}}
              </el-form-item>
            </el-col>
          </el-form-item>
          <el-form-item label="比率：" >
            <el-col :span="9">
              <el-form-item>
                {{this.viewPoint.rates}}
              </el-form-item>
            </el-col>
            <el-col class="line formRight1 userid" :span="5" style="text-align: right"><span class="rightx"></span>单位：</el-col>
            <el-col :span="9">
              <el-form-item >
                {{this.viewPoint.unit}}
              </el-form-item>
            </el-col>
          </el-form-item>
          <el-form-item label="显示值：" >
            <el-col :span="9">
              <el-form-item >
                <span style="color: #fff" v-if="this.viewPoint.show_data ===''">1</span>
                {{this.viewPoint.show_data}}
              </el-form-item>
            </el-col>
            <el-col class="line formRight1 userid" :span="5" style="text-align: right"><span class="rightx"></span>原始值：</el-col>
            <el-col :span="9">
              <el-form-item prop="name" required>
               {{this.viewPoint.value}}
              </el-form-item>
            </el-col>
          </el-form-item>
          <el-form-item label="命令1：" >
            <el-col :span="9">
              <el-form-item >
               <span style="color: #fff" v-if="this.viewPoint.command1 === ''">12</span>
                {{this.viewPoint.command1}}
              </el-form-item>
            </el-col>
            <el-col class="line formRight1 userid" :span="5" style="text-align: right"><span class="rightx"></span>命令2：</el-col>
            <el-col :span="9">
              <el-form-item prop="name" required>
                {{this.viewPoint.command2}}
              </el-form-item>
            </el-col>
          </el-form-item>
          <el-form-item label="命令3：" >
            <el-col :span="9">
              <el-form-item prop="username" required>
                {{this.viewPoint.command3}}
              </el-form-item>
            </el-col>
            <el-col class="line formRight1 userid" :span="5" style="text-align: right"><span class="rightx"></span>格式化：</el-col>
            <el-col :span="9">
              <el-form-item prop="name" required>
               {{this.viewPoint.format}}
              </el-form-item>
            </el-col>
          </el-form-item>
          <div class="safeLine"></div>
          <div class="safeLineBottomTitle">
            配置规则
          </div>
          <div v-if="viewPoint.type === 'analog'" >
            <div class="list" v-for="(list, index) in pointList">
              <el-row>
                <el-col :span="3">
                  <div class="grid-content bg-purple-light rightLine">{{index +1}} </div>
                </el-col>
                <el-col :span="7">
                  <div class="grid-content bg-purple-light" >
                    <span >事件等级：</span>
                    <span>{{list.label}}</span>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div class="grid-content bg-purple">
                    <span>下限：</span>
                    <span>{{list.end}}</span>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div class="grid-content bg-purple-light">
                    <span>上限：</span>
                    <span>{{list.begin}}</span>
                  </div>
                </el-col>
              </el-row>
            </div>
          </div>
          <div v-if="viewPoint.type != 'analog'" >
            <div class="list" v-for="(list, index) in pointList">
              <el-row>
                <el-col :span="3">
                  <div class="grid-content bg-purple-light rightLine">{{index +1}} </div>
                </el-col>
                <el-col :span="7">
                  <div class="grid-content bg-purple-light">
                    <span>事件等级：</span>
                    <span>{{list.label}}</span>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div class="grid-content bg-purple">
                    <span>原始值：</span>
                    <span>{{list.raw_label}}</span>
                  </div>
                </el-col>
                <!--<el-col :span="7">-->
                  <!--<div class="grid-content bg-purple-light">-->
                    <!--<span>上限：</span>-->
                    <!--<span>{{list.begin}}</span>-->
                  <!--</div>-->
                <!--</el-col>-->
              </el-row>
            </div>
          </div>


        </el-form>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    props: {
      viewPoint: {}
    },
    components: {
    },
    data() {
      return {
        pointList: [],
        updateDialogFalse: false,
        isIndeterminate: true
      }
    },
    created() {
      this.updateDialogShow = true
    },
    mounted() {
      this.pointList = this.viewPoint.rule_json
      console.log(this.pointList)
      // this.deleteConfigRow()
    },
    methods: {
      deleteConfigRow(index) {
        if (this.pointList.length > 1) {
          this.pointList.splice(index, 1)
        }
      },
      handleCheckAllChange(val) {
        this.isIndeterminate = false
      },
      handleCheckedCitiesChange(value) {
        const checkedCount = value.length
        this.checkAll = checkedCount === this.details.length
        this.isIndeterminate = checkedCount > 0 && checkedCount < this.details.length
      },
      // 子组件传值
      handleClose() {
        const dialogShow = this.updateDialogFalse // 所需要传的值
        this.$emit('giveFalse', dialogShow) // 传值的参数
        console.log(dialogShow)
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /*****************第一层弹窗*****************/
  .testColor{
    padding: 0;
    color: #fff;
  }
  .foorterLeft{
    width: 100px;
    height: 20px;
    font-size:14px;
    font-family:MicrosoftYaHei;
    font-weight:400;
    color:rgba(105,114,126,1);
    float: left;
  }
.safeLine{
  width: 710px;
  height: 1px;
  background-color: #E4E4E4;
  margin-top: 10px;
  margin-left: 10px;

}
.safeLineBottomTitle{
  width: 100%;
  height: 50px;
  line-height: 50px;
  font-size:14px;
  font-family:MicrosoftYaHei-Bold;
  font-weight:bold;
  color:rgba(50,56,66,1);
  margin-left: 10px;
}
.list{
  width: 680px;
  height: 50px;
  background-color: #F0F3F5;
  margin-top: 10px;
  margin-left: 10px;
  line-height: 50px;
  text-align: left;
  padding-left: 35px;
}
.rightLine{
  border-right: 1px solid #EBEDEE;
}
  /*****************第一层弹窗*****************/
  /deep/ .box > .el-dialog{
    width: 750px;
    height: 490px;
    margin-top: 30vh !important;
    border-radius: 4px;
    // overflow: auto;
  }
  /*****************第一层弹窗头部*****************/
  /deep/ .box > .el-dialog > .el-dialog__header{
    width: 750px;
    height: 39px;
    line-height: 43px;
    padding: 0;
    text-indent: 20px;
    font-weight: bolder;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    background-color: #e3e6ee;
  }
  /deep/ .box > .el-dialog > .el-dialog__header > .el-dialog__headerbtn{
    top: 12px;
  }
  /deep/ .box > .el-dialog > .el-dialog__header > .el-dialog__headerbtn > i{
    font-size: 18px;
    font-weight: bolder;
  }
  /*****************第一层弹窗内容*****************/
  /deep/ .box > .el-dialog > .el-dialog__body{
    padding: 0 0 0 10px ;
    line-height: 30px;
    margin-top: 20px;
    margin-bottom: 20px;
    min-height: 200px;
    max-height: 490px;
    overflow: auto;
    overflow-x: hidden;
  }
  /deep/ .box > .el-dialog > .el-dialog__body > .el-form > .el-form-item{
    margin-bottom: 0;
  }
  /deep/ .box > .el-dialog > .el-dialog__body > .el-form > .el-form-item > .el-form-item__label{
    color: #69727E;
    font-weight: normal;
  }
  /deep/ .box > .el-dialog > .el-dialog__body > .el-form > .el-form-item > .el-form-item__content > .el-input > .el-input__inner{
    width: 610px;
    height: 30px;
  }
  /*****************第一层弹窗底部*****************/
  /deep/ .box > .el-dialog > .el-dialog__footer{
    border-top: 1px solid #e3e6ee;
  }
  /*****************底部按钮*****************/
  /deep/ .dialog-footer{
    width: 100%;
    /*padding-top: 8px;*/
  }
  /deep/ .dialog-footer > .el-button{
    width: 80px;
    height: 30px;
    padding: 0;
  }
  /deep/ .el-input__inner {
    -webkit-appearance: none;
    background-color: #fff;
    background-image: none;
    border-radius: 4px;
    border: 1px solid #dcdfe6;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    color: #606266;
    display: inline-block;
    font-size: inherit;
    height: 30px;
    line-height: 30px;
    outline: 0;
    padding: 0 27px;
    -webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1);
    transition: border-color .2s cubic-bezier(.645,.045,.355,1);
    width: 100%;
  }
</style>
